<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/vue"></script>
  <style>
    /* 动画 */
    @keyframes shake {
      0% {
        opacity: 0;
        font-size: 14px;
      }

      50% {
        opacity: 0.3;
        font-size: 60px;
      }

      100% {
        opacity: 1;
        font-size: 40px;
      }
    }

    .lxw-enter-active,
    .lxw-leave-active {
      animation: shake 3s linear;
    }

    /* 过渡 */
    /* .v-enter-from {
      opacity: 0;
    }

    .v-enter-active,
    .v-leave-active {
      transition: opacity 3s ease-out;
    }

    .v-enter-to {
      opacity: 1;
    }

    .v-leave-to {
      opacity: 0;
    } */
  </style>
</head>

<body>
  <div id="root"></div>
  <script>
    /* 
      1. transition组件中声明name属性
      2. 定义类时，使用name属性值-enter/leave-*作为类名（自定义类名方式一）
      3. 类名默认以v-开头，自定义后以自定义name属性值开头
    */
    const app = Vue.createApp({
      template: `
      <transition name="lxw">
        <div v-if="isShow">Hello World1</div>
      </transition>
      <button @click="isShow = !isShow">切换</button>
    `,
      data() {
        return {
          isShow: false
        }
      }
    })
    const vm = app.mount('#root');

  </script>
</body>

</html>